#
#  Be sure to run `pod spec lint ios-swift-imbroker.podspec' to ensure this is a
#  valid spec and to remove all comments including this before submitting the spec.
#
#  To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |spec|

    # spec的名字，同podfile中指定依赖的名字一致。
    spec.name         = "ios-swift-tlog"
    # 版本号，同podfile中指定依赖的版本号一致。
    spec.version      = "1.0.6.5"
    spec.summary      = "iOS-tlog"

    # 描述，一般要比summary长度长些，否则pod lint时会有警告。非强制性。
    spec.description  = <<-DESC
                          iOS-tlog介绍。
                        DESC
    # 主页地址，一般指向github地址即可
    spec.homepage     = "http://gitcode.lietou.com/dev28/framework/ios/ios-swift-tlog.git"
    # 截图，一般不需要
    # spec.screenshots  = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"
    # 许可证，一般为MIT或BSD 3-clause,默认MIT即可
    spec.license      = "MIT"
    # 指定许可证的另一种方式
    # spec.license      = { :type => "MIT", :file => "FILE_LICENSE" }
    # 作者介绍 左边为名字，邮编为联系方式或者主页
    spec.author             = { "xuwc" => "xuwc@liepin.com" }
    # 指定使用系统平台
    # spec.platform     = :ios
    # 指定使用系统平台以及系统版本号
    spec.platform     = :ios, "9.0"
    # 是否采用arc，一般默认为true
    spec.requires_arc = true
    # 指定经爱哭使用方式，一般swift必须指定该项为true
    spec.static_framework = true
    # 指定swift版本号
    spec.swift_version = '5.0'
    # 指定module名字，一般swift使用时必须指定,注意不能使用-，要改为下划线_
    spec.module_name   = 'ios_swift_tlog'

    # 当使用多个平台时，可如下指定，一共就4个平台。ios,osx,watchos,tvos
    # spec.ios.deployment_target = "5.0"
    # spec.osx.deployment_target = "10.7"
    # spec.watchos.deployment_target = "2.0"
    # spec.tvos.deployment_target = "9.0"

    # 指定核心依赖库，开启后，仅加载指定的子库
    # spec.default_subspecs = 'Core', 'UI'

    # 下载资源远程仓库路径，tag为版本号，可手动指定，也可与spec版本保持一致。
    spec.source       = { :git => "http://gitcode.lietou.com/dev28/framework/ios/ios-swift-tlog.git", :tag => "#{spec.version}" }

    # 类资源文件，为ios-swift-tools.git根目录算起,一般为这样设置即可
    spec.source_files  = "classes/*"
    # 非下载的文件集合，一般用于readme.md等无需下载的资源使用
    #spec.exclude_files = "classes/Exclude"

    # 对外开放的头文件
    spec.public_header_files = "classes/ios_swift_tlog.h"
    # 私有文件，不暴露给外界使用
    #spec.private_header_files = "classes/imbroker/*.h"

    # 资源文件路径，此资源被直接使用
    # spec.resource  = "icon.png"
    # spec.resources = "Resources/**/*.png"

    # 资源文件指定，会被打包成bundle文件，使用资源时需要指定bundle名字, 一般采用这种
    # spec.resource_bundles = {
    #     'ios-swift-tools' => ['Resources/**/*]
    # }

    # spec.preserve_paths = "FilesToSave", "MoreFilesToSave"

    # 系统动态库依赖方式
    # spec.framework  = "SomeFramework"
    # spec.frameworks = "SomeFramework", "AnotherFramework"

    # 系统静态库依赖方式
    # spec.library   = "iconv"
    # spec.libraries = "iconv", "xml2"

    # 本地提供的静态库依赖方式
    # spec.vendored_libraries = "classes/**/*.a"

    # 本地提供的动态库依赖方式
    # subspec.ios.vendored_frameworks = "classes/**/*.framework"

    # 修改工程配置
    # spec.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }

    # 依赖其他第三方库
    # spec.dependency "JSONKit", "~> 1.4"

    # oc与swift混编，提供预编译头文件引用。
    # spec.prefix_header_contents = '#import "xxx.h"', '#import <UIKit/UIKit.h>'

    # *******
    # 将oc文件开放给swift使用，需要在classes类下面创建ios_swift_imbroker.h空文件，否则swift将无法找到该方法
    # *******

    # 子库创建方式
    # Log系统
    spec.subspec 'tlog' do |tlog|
        tlog.source_files = 'classes/*.{h,m}'
        tlog.public_header_files = 'classes/*.h'

        tlog.subspec 'tlog' do |tlogS|
            tlogS.source_files = 'classes/tlog/*.{h,m}'
            tlogS.public_header_files = 'classes/tlog/*.h'

            tlogS.subspec 'tlogManager' do |tlogManager|
                tlogManager.source_files = 'classes/tlog/tlogManager/*.{h,m}'
                tlogManager.public_header_files = 'classes/tlog/tlogManager/*.h'

                tlogManager.subspec 'onlineTimeStatistics' do |onlineTimeStatistics|
                    onlineTimeStatistics.source_files = 'classes/tlog/tlogManager/onlineTimeStatistics/*.{h,m}'
                    onlineTimeStatistics.public_header_files = 'classes/tlog/tlogManager/onlineTimeStatistics/*.h'
                end

                tlogManager.subspec 'userActionStatistics' do |userActionStatistics|
                    userActionStatistics.source_files = 'classes/tlog/tlogManager/userActionStatistics/*.{h,m}'
                    userActionStatistics.public_header_files = 'classes/tlog/tlogManager/userActionStatistics/*.h'
                end
          
                tlogManager.subspec 'autoStatistics' do |autoStatistics|
                    autoStatistics.source_files = 'classes/tlog/tlogManager/autoStatistics/*.{h,m}'
                    autoStatistics.public_header_files = 'classes/tlog/tlogManager/autoStatistics/*.h'

                    autoStatistics.subspec 'native' do |native|
                        native.source_files = 'classes/tlog/tlogManager/autoStatistics/native/*.{h,m}'
                        native.public_header_files = 'classes/tlog/tlogManager/autoStatistics/native/*.h'
                        # 去掉UIWebView
                        native.exclude_files    = 'classes/tlog/tlogManager/autoStatistics/native/UIWebView*'
                    end
                    
                    autoStatistics.subspec 'plugin' do |plugin|
                        plugin.source_files = 'classes/tlog/tlogManager/autoStatistics/plugin/*.{h,m}'
                        plugin.public_header_files = 'classes/tlog/tlogManager/autoStatistics/plugin/*.h'

                        plugin.subspec 'page' do |page|
                            page.source_files = 'classes/tlog/tlogManager/autoStatistics/plugin/page/*.{h,m}'
                            page.public_header_files = 'classes/tlog/tlogManager/autoStatistics/plugin/page/*.h'
                    end
                    end
                end
            end

            tlogS.subspec 'dbManager' do |dbManager|
                dbManager.source_files = 'classes/tlog/dbManager/*.{h,m}'
                dbManager.public_header_files = 'classes/tlog/dbManager/*.h'
            end

            tlogS.subspec 'uploadManager' do |uploadManager|
                uploadManager.source_files = 'classes/tlog/uploadManager/*.{h,m}'
                uploadManager.public_header_files = 'classes/tlog/uploadManager/*.h'

                uploadManager.subspec 'uploadPolicy' do |uploadPolicy|
                    uploadPolicy.source_files = 'classes/tlog/uploadManager/uploadPolicy/*.{h,m}'
                    uploadPolicy.public_header_files = 'classes/tlog/uploadManager/uploadPolicy/*.h'
                end
            end
        end

        tlog.dependency 'ios-swift-tools'
        tlog.dependency 'ios-swift-httpclient'
        tlog.dependency 'ios-swift-dbclient'
        tlog.dependency 'ios-swift-base'

    end

    spec.subspec 'tlogRN' do |tlogRN|
        tlogRN.source_files = 'classes/tlog/tlogManager/autoStatistics/rn/*.{h,m}'
        tlogRN.public_header_files = 'classes/tlog/tlogManager/autoStatistics/rn/*.h'
        
        tlogRN.dependency 'ios-swift-rnbase'
        tlogRN.ios.vendored_frameworks = 'ios_swift_rnbase.framework'
        tlogRN.dependency 'ios-swift-rnlibrary'    
        tlogRN.ios.vendored_frameworks = 'ios_swift_rnlibrary.framework'
    end

end

